package com.tjn.exercise;

public class Exercise03 {
    public static void main(String[] args) {
        Color green = Color.GREEN;
        green.show();

        switch(green){
            case RED:
                System.out.println("匹配到红色");
                break;

            case BLUE:
                System.out.println("匹配到蓝色");
                break;
            default:
                System.out.println("没有匹配到");
        }
    }
}

interface IColor{
    void show();
}

enum Color implements IColor{
    RED(255,0,0),BLUE(0,0,255),
    BLACK(0,0,0),YELLOW(255,255,0),
    GREEN(0,255,0);

    Color(int redValue, int greenValue, int blueValue) {
        this.redValue = redValue;
        this.greenValue = greenValue;
        this.blueValue = blueValue;
    }

    private int redValue;
    private int greenValue;
    private int blueValue;

    @Override
    public void show() {
        System.out.println("redValue = " + redValue + ", greenValue = " + greenValue + ", blueValue = " + blueValue);
    }
}